package com.speed.util.executor;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

/**
 * 线程执行工具 ,使用枚举，可扩展多个单例执行器，根据自己业务不同需求选用，现在默认一个，固定线程池长度为5
 * @author ZhouChiJian
 *
 */
public enum ExecutorUtil {

	INSTANCE(Executors.newFixedThreadPool(5));
	
	private ExecutorUtil(Executor _executor){
		executor = _executor;
	}
	
	private Executor executor ;

	public void run(Runnable task){
		executor.execute(task);
	}
}
